package com.gzx.spring.db.service.impl;

import com.gzx.risk.core.pojo.BinIntervalInfo;
import com.gzx.spring.db.entity.BinInterval;
import com.gzx.spring.db.mapper.BinIntervalMapper;
import com.gzx.spring.db.service.BinIntervalService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.commons.compress.utils.Lists;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

/**
 * <p>
 * 通用分值区间表 服务实现类
 * </p>
 *
 * @author qinpeng
 * @since 2025-10-22
 */
@Service
public class BinIntervalServiceImpl extends ServiceImpl<BinIntervalMapper, BinInterval> implements BinIntervalService {

    @Override
    public List<BinIntervalInfo> getBinIntervalInfo() {
        List<BinInterval> list = this.list();
        List<BinIntervalInfo> binIntervalInfos = Lists.newArrayList();
        for (BinInterval binInterval : list) {
            BinIntervalInfo binIntervalInfo = new BinIntervalInfo();
            BeanUtils.copyProperties(binInterval, binIntervalInfo);
            binIntervalInfos.add(binIntervalInfo);
        }
        return binIntervalInfos;
    }
}
